local ads__anju = fk.CreateSkill{
  name = "ads__anju",
}

ads__anju:addEffect(fk.TargetConfirming, {
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(ads__anju.name) and not data.cancelled and data.card.trueName == "slash" and
      table.find(player.room.alive_players, function (p)
        return data.from:inMyAttackRange(p) and p ~= data.from and p ~= player and not data.from:isProhibited(p, data.card)
      end) and
      not player:isNude()
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local targets = table.filter(room.alive_players, function (p)
      return data.from:inMyAttackRange(p) and p ~= data.from and p ~= player and not data.from:isProhibited(p, data.card)
    end)
    local tos = room:askToChoosePlayers(player, {
      min_num = 1,
      max_num = 1,
      targets = targets,
      skill_name = ads__anju.name,
      prompt = "#ads__anju-target",
      cancelable = true,
    })
    if #tos > 0 then
      event:setCostData(self, {tos = tos})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = event:getCostData(self).tos[1]
    room:drawCards(player, 1, ads__anju.name)
    if data:cancelCurrentTarget() then
      data:addTarget(to)
    end
  end,
})


Fk:loadTranslationTable{
  ["$ads__anju1"] = "交给你了。",
  ["$ads__anju2"] = "你来嘛～",
  ["ads__anju"] = "安居",
  [":ads__anju"] = "当你成为【杀】的目标时，你可以摸一张牌并选择其攻击范围内为此【杀】合法目标（无距离限制）的一名其他角色：若如此做，该角色代替你成为此【杀】的目标。",
  ["#ads__anju-target"] = "安居：你可以摸一张牌，将【杀】的目标转移给一名其他角色",
}


ads__anju:addAI({
  think_skill_invoke = Util.TrueFunc,
})


return ads__anju
